using AutoMapper;
using Pay.DTO;
using Pay.IService;
using Pay.Core;
using Pay.Data;

namespace Pay.Service.AutoMapper {
	public class LogisticsDetailsMapper : IStartupDto {
		private IMapperConfigurationExpression _cfg;
		public LogisticsDetailsMapper(IMapperConfigurationExpression cfg) {
			_cfg = cfg;
		}
		public void Execute() {
			Create();
		}
        protected virtual void Create()
        {
            _cfg.CreateMap<LogisticsDetails, logistics_details_dto>()
                .ForMember(dest => dest.id, src => src.MapFrom(c => c.Id))
                .ForMember(dest => dest.logisticsid, src => src.MapFrom(c => c.LogisticsId))
                .ForMember(dest => dest.logisticsstatus, src => src.MapFrom(c => c.LogisticsStatus))
              
                .ForMember(dest => dest.logisticstime, src => src.MapFrom(c => c.LogisticsTime.ToDateTime()))
               ;



            _cfg.CreateMap<logistics_details_dto, LogisticsDetails>()
                .ForMember(dest => dest.Id, src => src.MapFrom(c => c.id))
                .ForMember(dest => dest.LogisticsId, src => src.MapFrom(c => c.logisticsid))
                .ForMember(dest => dest.LogisticsStatus, src => src.MapFrom(c => c.logisticsstatus))
                .ForMember(dest => dest.LogisticsTime, src => src.MapFrom(c => c.logisticstime.ToUnix()))
               ;
        }
	}
}
